import Vue from 'vue'
import App from './App.vue'
import VueRouter from 'vue-router'  // 引入插件
import ElementUI from 'element-ui'  // 引入组件库
import 'element-ui/lib/theme-chalk/index.css';  // 引入组件对应的样式表
Vue.use(VueRouter) // 使用插件
Vue.use(ElementUI) // 使用组件库
// 插件使用规则
var router = new VueRouter({
  routes: [  // 定义具体规则
    {
      path: '/login', // 登录界面
      component: ()=>import('@/page/page-login.vue')
    },
    {
      path: '/home', 
      component: ()=>import('@/page/page-home.vue'),
      children: [
        {
          path: '/home', 
          component: ()=>import('@/page/page-index.vue'),
        },
        {
          path: '/user', 
          component: ()=>import('@/page/page-user.vue'),
        },
        {
          path: '/admin', 
          component: ()=>import('@/page/page-admin.vue'),
        },
        {
          path: '/add', 
          component: ()=>import('@/page/page-add.vue'),
        },
        {
          path: '/change', 
          component: ()=>import('@/page/page-user-change.vue'),
        },
      ]
    },
    {
      path: '/demo', 
      component: ()=>import('@/page/lesson/page-20')
    }
  ]
})

Vue.config.productionTip = false


new Vue({
  render: h => h(App),
  router // 将具体的路由规则应用到项目上
}).$mount('#app')
